package com.feisuanyz.controller;

import com.feisuanyz.query.LogoManagementQuery;
import com.feisuanyz.response.RestResult;
import com.feisuanyz.service.LogoManagementService;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/logo")
public class LogoManagementController {

    @Autowired
    private LogoManagementService logoManagementService;

    @PostMapping("/upload")
    public RestResult uploadLogo(@RequestParam Integer userId, @Valid @RequestBody LogoManagementQuery query) {
        return logoManagementService.uploadLogo(userId, query);
    }

    @DeleteMapping("/delete/{logoId}")
    public RestResult deleteLogo(@RequestParam Integer userId, @PathVariable Integer logoId) {
        return logoManagementService.deleteLogo(userId, logoId);
    }

    @PutMapping("/update/{logoId}")
    public RestResult updateLogoUrl(@RequestParam Integer userId, @PathVariable Integer logoId, @RequestParam String newLogoUrl) {
        return logoManagementService.updateLogoUrl(userId, logoId, newLogoUrl);
    }
}